package it.tcm.TeacherClassMate.facade;

import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Session;

import it.tcm.TeacherClassMate.beans.TypologyBean;
import it.tcm.TeacherClassMate.dao.TypologyDao;
import it.tcm.TeacherClassMate.persistent.HibernateUtil;


public class TypologyManageBase {

	 	private Logger log = Logger.getLogger(this.getClass().getName());	   
	    TypologyDao tDao = new TypologyDao();
	  
	    public List<TypologyBean> getAll() {
		    Session session = null;
		    List<TypologyBean> typologyList = null;
			try {
				session = HibernateUtil.createNewSessionAndTransaction();
				tDao.setSession(session);
				typologyList = tDao.findAll();
			    HibernateUtil.commitTransactionAndCloseSession(session);
			} catch (Exception e) {
				HibernateUtil.rollbackTransaction(session);
			    log.error("Errore in reading all typology ", e);
			} finally {
			}
			return typologyList;
	    }
	   

}
